import Request from '@/libs/service/index';

import type { IPage } from './type';
import { BASE_URL } from '../../request/config';

enum RoleAPI {
    RoleList = '/role/list',
    RoleAdd = '/role/add',
    RoleUpdate = '/role/update',
    RoleRemove = '/role/remove'
}

export function roleListRequest(page: IPage) {
    return Request.post({
        url: BASE_URL + RoleAPI.RoleList,
        data: page,
    });
}

export function roleAddRequest(obj: any) {
    return Request.post({
        url: BASE_URL + RoleAPI.RoleAdd,
        data: obj,
    });
}

export function roleUpdateRequest(obj: any) {
    return Request.post({
        url: BASE_URL + RoleAPI.RoleUpdate,
        data: obj,
    });
}

export function roleRemoveRequest(obj: any) {
    return Request.post({
        url: BASE_URL + RoleAPI.RoleRemove,
        data: obj,
    });
}